
option mprint;

%Macro pulldata(out= , register= , varlist= , renamevars= , datasetl= , renamel=, reststart= , restend=);

data &out. (drop=&register.SourceYear &restend.);
set raw.&register.v (keep=pnr &register.SourceYear &varlist. where=(&register.SourceYear>=&start_dataperiod. and &register.SourceYear<=&end_dataperiod. &reststart.));
year=&register.SourceYear;
length year 8;
run; 

%if &renamel. ne "" %then %do;
%let renamelist=&renamel. &renamevars.;
%end;
%if &datasetl. ne "" %then %do;
%let datasetlist=&datasetl. &out.;
%end;

%Mend pulldata;
